﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
namespace ZF.BLL.Linq
{
    /// <summary>
    /// 表达式容器接口,用来执行Linq的条件查询
    /// </summary>
    public interface IFilterExpressionContainer
    {
        /// <summary>
        /// 返回表达式集合
        /// </summary>
        /// <returns></returns>
        IList<FilterExpression> GetExpressions();
        /// <summary>
        /// 添加一个表达式
        /// </summary>
        /// <param name="predicate"></param>
        /// <param name="values"></param>
        void AddFilterExpression(string predicate, params object[] values);
        /// <summary>
        /// 移除表达式
        /// </summary>
        /// <param name="predicate"></param>
        /// <param name="values"></param>
        void RemoveFilterExpression(string predicate, params object[] values);
        /// <summary>
        /// 移除所有符合条件的表达式
        /// </summary>
        /// <param name="predicate"></param>
        void RemoveAllFilterExpression(string predicate);
        /// <summary>
        /// 移除所有的表达
        /// </summary>
        void RemoveAllFilterExpression();
    }
    /// <summary>
    /// 表达模型
    /// </summary>
    [Serializable]
    public class FilterExpression
    {
        public string Predicate { get; set; }
        public object[] Values { get; set; }
    }
}
